var msg = ["userName", "age", "sex"];
var stdin = process.stdin;
var index = 0; //定义索引
var infor = []; //存储用户输入的信息
console.log(msg[0] + ":");

// 监听用户输入，接收到回调函数中
stdin.on("data", function(chunk) { //chunk是实时输入的数据
    var str = chunk.toString("utf-8");
    infor[index] = str;
    index++;
    if(index == 3) {
        console.log(infor);
        process.exit();
    }
    console.log(msg[index] + ":");
})